<template>
  <view class="setting">
    <view class="setting-item" v-for="item in settingList" :key="item.id" @tap="itemClick(item.id)">
      <view class="left">
        <view class="title">{{item.name}}</view>
      </view>
      <view class="right">
        <u-icon name="arrow-right" color="#111" size="22"></u-icon>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        settingList: [{
            id: 1,
            name: '个人信息',
          },
          {
            id: 2,
            name: '修改密码',
          },
          {
            id: 3,
            name: '修改手机号',
          },
          {
            id: 4,
            name: '清除缓存',
          },
          {
            id: 5,
            name: '关于我们',
          },
          {
            id: 6,
            name: '隐私条款',
          },
          {
            id: 7,
            name: '版本更新',
          },
          {
            id: 8,
            name: '退出登录',
          }
        ]
      }
    },
    methods: {
      itemClick(index) {
        switch (index) {
          case 1://个人信息
            uni.navigateTo({
              url: '../../pages/setting/myInfo/myInfo'
            })
            break;
          case 2: //修改密码
            uni.navigateTo({
              url: '../../pages/setting/updatePsd/updatePsd'
            })
            break;
          case 3: //修改手机号码
            uni.navigateTo({
              url: '../../pages/setting/updatePhone/updatePhone'
            })
            break;
          case 4: //清除缓存
            uni.showToast({
              icon: 'none',
              title: '清除缓存成功！'
            })
            break;
          case 5: //关于我们
            uni.navigateTo({
              url: '../../pages/setting/aboutUs/aboutUs'
            })
            break;
          case 6: //隐私条款
            uni.navigateTo({
              url: '../../pages/setting/hide/hide'
            })
            break;
          case 7: //版本更新
            uni.showToast({
              icon: 'none',
              title: '当前版本为最新！'
            })
            break;
          default:
            break;
        }
      }
    }
  }
</script>

<style lang="scss" scoped>
  .setting {
    // #ifdef H5
    height: calc(100vh - 44px);
    //  #endif
    // #ifdef MP-WEIXIN
    height: 100vh;
    // #endif
    background-color: #F5F7FA;

    .setting-item {
      height: 112upx;
      background: #fff;
      border-bottom: 1upx solid #e6e6e6;
      display: flex;
      justify-content: space-between;

      .left {
        display: flex;

        .img {
          width: 100upx;
          height: 100%;
          display: flex;
          justify-content: center;
          align-items: center;

          .icon {
            width: 60upx;
            height: 60upx;
          }
        }

        .title {
          padding: 0 30upx;
          font-size: 30upx;
          font-weight: 400;
          color: #424242;
          letter-spacing: 0.14upx;
          height: 100%;
          display: flex;
          justify-content: center;
          align-items: center;
        }
      }

      .right {
        width: 60upx;
        display: flex;
        align-items: center;
      }
    }
  }
</style>
